<%@ page language="java" import="java.util.*" pageEncoding="utf-8"
	isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
    String path = request.getContextPath();
			String basePath = request.getScheme() + "://"
					+ request.getServerName() + ":" + request.getServerPort()
					+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改系统角色信息</title>

<script type="text/javascript"
	src="<%=request.getContextPath()%>/easyui/jquery.min.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/easyui/locale/easyui-lang-zh_CN.js"></script>
<link
	href="<%=request.getContextPath()%>/easyui/themes/default/easyui.css"
	rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/easyui/themes/icon.css"
	rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/style.css"
	rel="stylesheet" type="text/css" />
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jquery-2.1.4.min.js"></script>
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/css/jPages.css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/umeditor/themes/default/css/umeditor.css">
<link rel="stylesheet"
	href="<%=request.getContextPath()%>/css/animate.css">
<script src="<%=request.getContextPath()%>/js/jquery-1.8.2.min.js"></script>
<script src="<%=request.getContextPath()%>/js/jPages.js"></script>
<!--ueditor插件js-->
<script type="text/javascript" src="<%=request.getContextPath()%>/umeditor/third-party/template.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/umeditor/umeditor.config.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/umeditor/umeditor.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/umeditor/lang/zh-cn/zh-cn.js"></script>
<style type="">
dl, dt, dd, span {
	display: block;
}

.forminfo li i {
	padding-left: 3px;
}
input{
   border: solid 1px #d7a372;
}
</style>
</head>

<body>
	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><ema href="javascript:void">首页</em></li>
			<li><ema href="javascript:void">内容管理</em></li>
			<li><ema href="javascript:void">消息管理</em></li>
			<li><ema href="javascript:void">添加消息</em></li>
		</ul>
	</div>
	</br>
	</br>
	<ul class="forminfo">
		<li>推送标题：<input name="title" type="text" style="width:300px;height:20px;"/></li>
		<li>推送用户：
		   <div class="col-sm-3" style="width: 100%">
				<table class="table">
					<tr>
						<td style="width: 100px;"><input id="start_the_boot" type="checkbox" name="actionId" value="全部"><i>全部用户</i></td>
						<td style="width: 100px;"><input class="start_the_boot" type="checkbox" name="actionId" value="VIP用户"><i>VIP用户</i></td>
						<td style="width: 100px;"><input class="start_the_boot" type="checkbox" name="actionId" value="非vip用户"><i>非VIP用户</i></td>
						<td style="width: 100px;"><input class="start_the_boot" type="checkbox" name="actionId" value="普通会员"><i>普通会员</i></td>
						<td style="width: 100px;"><input class="start_the_boot" type="checkbox" name="actionId" value="铜牌会员"><i>铜牌会员</i></td>
						<td style="width: 100px;"><input class="start_the_boot" type="checkbox" name="actionId" value="银牌会员"><i>银牌会员</i></td>
						<td style="width: 100px;"><input class="start_the_boot" type="checkbox" name="actionId" value="金牌会员"><i>金牌会员</i></td>
					</tr>
				</table>
		</div>
		</li>
		<li>推送时间：
		   <input name="push_time" type="date" id="push_time"/>
		</li>
		<li>推送内容：
		 <div style="margin-bottom:20px;" class="col-sm-10">
			<script type="text/plain" id="myEditor" class="form-control" style="width:100%;height:240px;"></script>
		</div>	
		</li>
	</ul>
	<div style="margin-left: 400px;">
		<input name="" type="button" class="tijiao" value="提交"
			style="width: 96px; height: 35px; line-height: 35px; color: #fff; background: red; font-size: 14px; font-weight: bold; border-radius: 3px; cursor: pointer;" />
		&nbsp;<input name="quxiao" type="button" class="cancel" value="取消" />
	</div>
	<div class="tip">
		<div class="tiptop">
			<span>提示信息</span>
		</div>
		<div class="tipinfo">
			<span><img
				src="<%=request.getContextPath()%>/images/ticon.png" /></span>
			<div class="tipright">
				<p>添加成功!</p>
				<cite>点击确定返回消息列表 。</cite>
			</div>
		</div>
		<div class="tipbtn">
			<input name="" type="button" class="sure" value="确定" />&nbsp;<input
				name="" type="button" class="cancel" value="取消" />
		</div>
	</div>
	<script type="text/javascript">
	//实例化编辑器
    var um = UM.getEditor('myEditor');
    //失去焦点
    um.addListener('blur',function(){
    	//判断是否有内容
        if(UM.getEditor('myEditor').hasContents()){
        	$("#infomationContent").val(UM.getEditor('myEditor').getContent());
        }
    });
    //获得焦点
    um.addListener('focus',function(){
        
    });
    	$(function(){
    		$("input[name=quxiao]").click(function(){
	   			window.location.href="/htx-backer/selectMessageList";
	   		});
    		
    		$(".tijiao").click(function(){
    			var title = $("input[name=title]").val();
    			if(title == null || title == ""){
    				alert("消息标题不能为空");
    				return;
    			}
    			var array = new Array();
				$('input[type=checkbox]:checked').each(function(){ 
					array.push($(this).val()); 
				}); 
				var scope = array.join(",");
				if(scope == ""){
					alert("请至少选中一个用户角色");
					return;
				}
				var push_time = $('#push_time').val();
				if(push_time == null || push_time == ''){
					alert("请选择推送时间");
					return;
				}
				var content = UM.getEditor('myEditor').getContent();
				if(content == null || content == ''){
					alert("请输入消息内容");
					return;
				}
   	    		$.ajax({
   	   				type:"post",
   	   				url:"/htx-backer/insertMessage", 
   	   				data:{
   	   					title:title,
   	   					content:content,
   	   					push_time:push_time,
   	   					scope:scope,
	   	   			},
	   	   			dataType:"json",
	   	   			success:function(data){
	   	   				var flag = data.flag;
	   	   				if(flag == 1){
	   	   					$(".tip").fadeIn(200);
	   	   				}
	   	   			}
	   			})
	    	})
    	
	   		$(".sure").click(function(){
	   			window.location.href="/htx-backer/selectMessageList";
	   		});
	
	   		$(".cancel").click(function(){
	   			$(".tip").fadeOut(100);
	   		});
	   		$("#start_the_boot").click(function(){
				 if($(this).is(':checked')){
					$(".start_the_boot").each(function(){
						$(this).prop("checked",true);
					}) 
				}else{
					$(".start_the_boot").each(function(){
						$(this).prop("checked",false);
					})
				} 
			});
    	})
    	
    </script>
</body>
</html>
